# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=duckscript
pkgver=0.9.3
pkgrel=0
pkgdesc="Simple, extendable and embeddable scripting language"
url="https://sagiegurari.github.io/duckscript/"
# loongarch64: blocked by libc crate
arch="all !loongarch64"
license="Apache-2.0"
makedepends="
	bzip2-dev
	cargo
	cargo-auditable
	openssl-dev
	zlib-dev
	"
source="https://github.com/sagiegurari/duckscript/archive/$pkgver/duckscript-$pkgver.tar.gz
	use-zlib.patch
	"

case "$CARCH" in
# fails on builders for some reason with new networking
arm*|aarch64) options="$options !check" ;;
esac

_cargo_opts="--frozen --no-default-features --features tls-native"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build $_cargo_opts --release
}

check() {
	cargo test $_cargo_opts
}

package() {
	install -D -m755 target/release/duck -t "$pkgdir"/usr/bin/
}

sha512sums="
d7c70194646083c4613ceff2c5b1a832c145e92829e2db479d9c3dc7d260e50fa270b9be6beefbb4233761fa63f203c5532ac2e7ff3e3d05258ac5a8269c3acc  duckscript-0.9.3.tar.gz
2c4761321af45a356215bfc87e84a2878935e4caf10fd693a1312e3355aece0735d696773026ebec42d0ffab766b1a4b900e70464c9e34efdf90d54072961fdc  use-zlib.patch
"
